<template>
	<view>
		<u-navbar
			:title="title"
			:autoBack="!isIndex"
			:placeholder="true"
			:titleStyle="{ color: '#fff' }"
			bgColor="#c1cbd7"
			leftIconColor="#fff"
			height="46px"
		>
			<template #left v-if="isIndex">
				<u--image
					@click="toIndex"
					:showLoading="true"
					src="/static/logo.png"
					width="30px"
					height="30px"
				></u--image>
			</template>
		</u-navbar>
	</view>
</template>

<script>
export default {
	name: 'navBar',
	data() {
		return {};
	},
	props: {
		// 当前导航组件是否使用在首页
		isIndex: {
			type: Boolean,
			default: false
		},
		title: {
			type: String,
			default: '标题'
		}
	},
	methods: {
		toIndex() {
			uni.switchTab({
				url: '/pages/index/index'
			});
		}
	}
};
</script>

<style></style>
